package cn.javadog.algorithm.e101_200;

/**
 * 二叉树的最大深度
 * https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/
 * @author Sprite
 */
public class Algorithm104 {

	public static void main(String[] args) {

	}

	public int maxDepth(TreeNode root) {
		if (root == null) return 0;
		int l = maxDepth(root.left);
		int r = maxDepth(root.right);
		return Math.max(l,r)+1;
	}

	static class TreeNode {
		int val;
		TreeNode left;
		TreeNode right;
		TreeNode(int x) { val = x; }
	}

}

